﻿@model List<BTL.OnlineTestingSocial.Application.Web.Infrastructure.ViewModels.QuestionGroupItemViewModel>

@if(Model != null && Model.Count >0){int i = 0; int j = 0;

    foreach (var item in Model)
    {
        i++; j++;
        @*item*@
        <div id="tempPic@(j.ToString())">
            <div class="bgpic_item" id="pic_item_@(item.Id.ToString())">
                    
                <div class="utils" id="util" >
                    @*main picture*@
                    <div style="float:left;width:100%;min-height:68px;" onclick="">
                        @{string main_thum_url = string.IsNullOrEmpty(item.Image) ? "~/images/photo_01.jpg" : "~/images/"+ item.Image; }
                        <img src="@Url.Content(main_thum_url)" class="img" id="main_img" />
                    </div>
                </div>
                @*content*@
                <div class="bgcomment_content">
                    <br />
                    <div style="font-size: 3px; padding-top: 0px; font-style: italic; text-align: right;
                        width: 100%; line-height: 1.3">
                        &nbsp;
                    </div>

                    <strong>Câu hỏi:</strong> 
                    
                    <br />
                    <span style="font-size: 12px;font-style: italic; text-align: right;
                        width: 100%; line-height: 2.0">
                        <a style="color:#1093EE;text-decoration:none">@item.Name</a> hỏi - 
                        <a style="color:#1093EE;text-decoration:none">Đề Thi Vật Lý Lớp 6</a>
                    </span>
                    <br />
                    <div style="font-size: 11px; padding-top: 10px; font-style: italic; text-align: left;width: 110%;">
                        <span style="float:left"><strong id="nocomms_0" style="color:inherit;font-size:12px">
                            @(item.TotalQuestion)</strong>
                        câu hỏi  - &nbsp;</span>
                        <span style="float:left">
                        <strong id="nocomms_0" style="color:inherit;font-size:12px">
                            @(item.Comments!= null?item.Comments.Count():0)</strong>
                        bình luận  - &nbsp;</span>
                        <span style="float:left">
                            <strong id="nolikes_0" style="color:inherit;font-size:12px">
                                @item.Likes</strong>
                            likes 
                        </span>
                        <img src="@Url.Content("~/images/icon_like.jpg")" style="float:left;width:22px;height:22px;margin:-6px 2px 0px 3px;" /> 
                        <span style="float:left">-
                        <strong id="nounlikes_0" style="color:inherit;font-size:12px">
                            @item.Dislikes</strong> dislikes
                        </span> 
                        <img src="@Url.Content("~/images/icon_dislike.jpg")" style="float:left;width:22px;height:22px;margin:-6px 2px 0px 3px;" />
                    </div>
                </div>
                <div style="width: 100%; float: left;" id="outside_updatePicComment">
                    <div style="width: 100%" id="updatePicComment_">
                    </div>
                </div>
                <div id="bgcomment_item_">
                    @if (item.Comments != null)
                    {
                        for(int ii = 0;ii < (item.Comments.Count() > 3? 3 : item.Comments.Count());ii++)
                        {
                            Html.RenderPartial("pvwComment", item.Comments.ElementAt(ii));
                        }
                    }
                </div>
                    

                <div class="bgwritecomm " id="bgViewAllComm_" style="@(item.Comments != null && item.Comments.Count() > 3 ? "display:block":"display:none")" onclick="">
                    @{
                        <span class="text">xem tat ca binh luan</span>
                    }
                </div>

            </div>
        </div>
    
        <script>
            changePicItem2Parent('vert_pic_item_', '#tempPic@(j.ToString())');
        </script>
    
    
    }

    <script>
            updaterAfterGetMoreCompleted('#updatePic', 
                                         @(ViewData["isgetNextPage"] != null ? ViewData["isgetNextPage"].ToString().ToLower() : "false"),
                                         '@(ViewData["isinit"] == null ? ViewData["PageIndex"] : "null")' );
    </script>

}
else
{
    if (ViewData["isgetNextPage"] != null && ViewData["isgetNextPage"].ToString().ToLower().Equals("false"))
    {
        <script>
            stopLoadPic();
        </script>
    }
    else if (ViewData["isgetNextPage"] != null && ViewData["isgetNextPage"].ToString().ToLower().Equals("true"))
    {
        <script>
                isgetDetail = true;
                updaterAfterGetMoreCompleted('#updatePic', 
                                             @(ViewData["isgetNextPage"] != null ? ViewData["isgetNextPage"].ToString().ToLower() : "false"),
                                             '@(ViewData["isinit"] == null ? ViewData["PageIndex"] : "null")');
        </script>
    }

    <script>
        removeWaitingDiv();
    </script>
}